package com.wavehi.functionType;

import com.wavehi.pojo.User;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.GenericApplicationContext;


/**
 * @Author WaveHi
 * @Date 25/10/2021 下午 9:09
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description Demonstrate the use of function style.
 */
public class FunctionStyleDemo01 {

    @Test
    public void use01() {
        //创建GenericApplicationContext 对象
        GenericApplicationContext genericApplicationContext = new GenericApplicationContext();
        //清空注册内容
        genericApplicationContext.refresh();
        //注册对象
        genericApplicationContext.registerBean("user",User.class, () -> new User());
        //获取注册的对象
        System.out.println(genericApplicationContext.getBean("user"));

    }

}
